home *** CD-ROM | disk | FTP | other *** search
/ Aminet 37 / Aminet 37 (2000)(Schatztruhe)[!][Jun 2000].iso / Aminet / dev / mui / MadMatrixsrc.lha / MadMatrix.src / libs.c < prev    next >
Encoding:
C/C++ Source or Header  |  2000-02-15  |  1.1 KB  |  64 lines

  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. #include <proto/intuition.h>
  5. #include <proto/graphics.h>
  6. #include <proto/exec.h>
  7.  
  8. #include <libraries/mui.h>
  9.  
  10. #include "libs.h"
  11.  
  12. struct IntuitionBase *IntuitionBase=NULL;
  13. struct GfxBase  *GfxBase=NULL;
  14. struct Library  *MUIMasterBase=NULL;
  15. struct Library  *UtilityBase=NULL;
  16.  
  17.  
  18.  
  19. int Ouvrir_Libs(void )
  20. {
  21.   if ( !(IntuitionBase=(struct IntuitionBase *) OpenLibrary((UBYTE *)"intuition.library",39)) )
  22.     return(0);
  23.  
  24.   if ( !(GfxBase=(struct GfxBase *) OpenLibrary((UBYTE *)"graphics.library",0)) )
  25.   {
  26.     Fermer_Libs();
  27.     return(0);
  28.   }
  29.  
  30.  
  31.   if ( !(MUIMasterBase=OpenLibrary((UBYTE *)MUIMASTER_NAME,19)) )
  32.   {
  33.     Fermer_Libs();
  34.     return(0);
  35.   }
  36.  
  37.   if ( !(UtilityBase=OpenLibrary("utility.library",0)) )
  38.   {
  39.     Fermer_Libs();
  40.     return(0);
  41.   }
  42.  
  43.  
  44.   return(1);
  45. }
  46.  
  47. void Fermer_Libs(void )
  48. {
  49.   if ( IntuitionBase )
  50.     CloseLibrary((struct Library *)IntuitionBase);
  51.  
  52.   if ( GfxBase )
  53.     CloseLibrary((struct Library *)GfxBase);
  54.  
  55.   if ( MUIMasterBase )
  56.     CloseLibrary(MUIMasterBase);
  57.  
  58.   if ( UtilityBase )
  59.     CloseLibrary((struct Library *)UtilityBase);
  60.  
  61. }
  62.  
  63.  
  64.